home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / Utilities / Installer v3.4.3 / Examples - Installer 3.4 / Action Atom Samples / Lock File Installer AA Sample / SetLockBitAtomSample.r < prev   
Encoding:
Text File  |  1993-06-15  |  5.4 KB  |  164 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.4 sample: Action Atoms
  6.  *
  7.  *    File:        SetLockBitAtomSample.r -    Rez Source
  8.  *
  9.  *  Modifications:
  10.  *        5/19/93: RRK Changed Target file spec typeCrMustMatch flag setting to
  11.  *                        typeCrNeedNotMatch and included comment that this will
  12.  *                        allow the replacement of the target file if for some reason
  13.  *                        the file or creator are different.
  14.  *                     Used InstallerCommon.r defines.
  15.  *
  16.  *    by:            Rich Kubota
  17.  *
  18.  *    Copyright © 1992 Apple Computer, Inc.
  19.  *    All rights reserved.
  20.  *
  21.  *------------------------------------------------------------------------------
  22.  *
  23.  * Install application "TheProgram" into the "Root directory and lock the file.
  24.  * For this sample, I use TeachText as the program to install and lock.
  25.  * Demonstrates implementation of an action atom.
  26.  *
  27.  * Note: This action atom sample is only compatible with Installer 3.3 and 3.4
  28.  *----------------------------------------------------------------------------*/
  29. /*
  30.  
  31. You can build the script with the following lines:
  32.  
  33.         rez  -o "SetLockBitAtomSample" -t 'bbkr' -c 'bbkr' "SetLockBitAtomSample.r"
  34.         setfile -a i "SetLockBitAtomSample"
  35.         scriptcheck -p "SetLockBitAtomSample"
  36.  
  37. ------------------------------------------------------------------------------------------
  38. */
  39.  
  40. #include "Types.r"
  41. #include "InstallerTypes.r"
  42. #include "InstallerCommon.r"        /* list of macros to simplify list */
  43.  
  44. /* 'inaa' code resource definition */
  45. #define        aaCodeID            10000
  46.  
  47. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  48. #define kScriptCheckSetsDate    0x01
  49.  
  50. /* Definitions for the file spec atoms (specifications for source and destination files) */
  51. #define fsSourceProgram            2000
  52. #define fsTargetProgram            2001
  53.  
  54. /* This is the name of the source disk */
  55. #define ProgramDisk "Program Disk:"
  56.  
  57. /* where we want to install our file. */
  58. #define TargetPath    ":"
  59.  
  60. /* Definition for the package. */
  61. #define pkTheProgram            3000
  62.  
  63. /* Definition for the file atom */
  64. #define faProgram                4000
  65.  
  66. /* Definition for the package comment resource */
  67. #define cmtTheProgram            5000
  68.  
  69. /* Definitions for the action atom resources */
  70. #define aaSetLockBit            6000
  71.  
  72. /* May 19, 1993 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  73. /* this value to a LongInt seconds value needed by the Installer. */
  74. #define currentReleaseDate        5191993    
  75. #define currentVersion            102     /* Version 1.0.2 goes in the 'icmt' rsrc */
  76.  
  77. #define iconTheProgram            5100
  78.  
  79. /************************** Easy Install Rule resources **********************************/
  80.  
  81. /***************************** Package Resources ************************************************/
  82. resource 'inpk' (pkTheProgram) {
  83.     format0 {
  84.         ShowsOnCustom,                 /* Package appears in the Custom Install display */
  85.         Removable,                    /* Package can be removed */
  86.         dontForceRestart,            /* no need to restart */
  87.         cmtTheProgram,                 /* package's 'icmt' resource id */
  88.         0,                            /* Package size (filled in by ScriptCheck) */
  89.         "TheProgram", {                /* package name for package that shows on custom */
  90.             'infa', faProgram;
  91.             'inaa', aaSetLockBit;
  92.         }
  93.     }
  94. };
  95.  
  96. /***************************** Comments ************************************************/
  97. resource 'icmt' (cmtTheProgram) {
  98.     currentReleaseDate,
  99.     currentVersion,
  100.     iconTheProgram,
  101.     "This package contains TheProgram. "
  102. };
  103.  
  104. resource 'ICON' (iconTheProgram) {
  105.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  106.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  107.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  108.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  109.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  110.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  111.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  112.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  113. };
  114.  
  115.  
  116. /********************************************* File Specs ******************************************/
  117. /* Source File Specs */
  118. resource 'infs' (fsSourceProgram) {
  119.     'APPL',                                /* File Type */
  120.     'ttxt',                                /* Creator */
  121.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  122.     noSearchForFile,                    /* Do not search the source disk for the file */
  123.     TypeCrMustMatch,                    /* file type and creator on source disk must match */
  124.     ProgramDisk"TeachText"                /* Path to the file */
  125. };
  126.  
  127. /* Target File Specs */
  128. resource 'infs' (fsTargetProgram) {
  129.     'APPL',                                /* File Type */
  130.     'ttxt',                                /* Creator */
  131.     kNoDateStampCheck,                    /* creation date must be zero for target file spec */
  132.     noSearchForFile,                    /* Do not search the target disk for the file */
  133.     typeCrNeedNotMatch,                    /* file to be replaced even if F&C don't match  */
  134.     TargetPath"TeachText"                /* destination Path */
  135. };
  136.  
  137. /******************************************** File Atoms ************************************************/
  138. resource 'infa' (faProgram) {
  139.     format0 {
  140.         StdRemLeaveNewerCopy,            /* see InstallerCommon.r */
  141.         fsTargetProgram,                /* TARGET file spec for this file */
  142.         fsSourceProgram,                 /* SOURCE file spec for this file */
  143.         0,                                /* atom size (filled in by ScriptCheck) */
  144.         ""                                /* Atom Description (Installer will use file name) */
  145.     };
  146. };
  147.  
  148.  
  149. resource 'inaa'    (aaSetLockBit) {
  150.     format1 {
  151.         continueBusyCursors,
  152.         actAfter,
  153.         dontActOnRemove,
  154.         actOnInstall,
  155.         'infn',
  156.         aaCodeID,
  157.         fsTargetProgram,                /* pass in the 'infs' resource ID of the file to lock */
  158.         "Set Locked Bit of Target file based on target infs resource ID"
  159.     }
  160. };
  161.  
  162. INCLUDE    "SetLockBit.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes);
  163.  
  164.